<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>面向对象-多态</title>
</head>

<script>
    function Dog() {
        this.leg = 4;
        this.bark = null;
    }



    function Hashiqi(){
        this.bark = function () {
            alert("wuwu")
        }
    }

    function jingba() {
        this.bark = function(){
            alert("wangwang")
        }
    }


    Hashiqi.prototype = jingba.prototype = new Dog();

    var h = new Hashiqi();
    var j = new jingba();

    function test(dog){

        dog.bark();
        console.log("leg----"+dog.leg)
    }

    test(j)

</script>
<body>

</body>
</html>

